home *** CD-ROM | disk | FTP | other *** search
/ Kit PC World De Ampliacion De Windows 95 / Kit PC World de ampliacion de Windows 95.iso / internet / sweeper / samples / olecon~1 / controls / button / button~1.h < prev    next >
Text File  |  1995-11-25  |  3KB  |  113 lines

  1. //=--------------------------------------------------------------------------=
  2. // ButtonCtl.H
  3. //=--------------------------------------------------------------------------=
  4. // Copyright  1995  Microsoft Corporation.  All Rights Reserved.
  5. //
  6. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 
  7. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 
  8. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 
  9. // PARTICULAR PURPOSE.
  10. //=--------------------------------------------------------------------------=
  11. //
  12. // class declaration for the Button control.
  13. //
  14. #ifndef _BUTTONCONTROL_H_
  15.  
  16. #include "IPServer.H"
  17. #include "CtrlObj.H"
  18. #include "ButtonInterfaces.H"
  19. #include "Dispids.H"
  20.  
  21. typedef struct tagBUTTONCTLSTATE {
  22.  
  23.     char    szCaption[128];
  24.  
  25. } BUTTONCTLSTATE;
  26.  
  27. //=--------------------------------------------------------------------------=
  28. // CButtonControl
  29. //=--------------------------------------------------------------------------=
  30. // our control.
  31. //
  32. class CButtonControl : public COleControl, public IButton, public ISupportErrorInfo {
  33.  
  34.   public:
  35.     // IUnknown methods
  36.     //
  37.     DECLARE_STANDARD_UNKNOWN();
  38.  
  39.     // IDispatch methods
  40.     //
  41.     DECLARE_STANDARD_DISPATCH();
  42.  
  43.     // ISupportErrorInfo methods
  44.     //
  45.     DECLARE_STANDARD_SUPPORTERRORINFO();
  46.  
  47.     // IButton methods
  48.     //
  49.     // TODO: copy over the method declarations from ButtonInterfaces.H
  50.     //       don't forget to remove the PURE from them.
  51.     //
  52.     STDMETHOD(get_Caption)(BSTR FAR* pbstrCaption);
  53.     STDMETHOD(put_Caption)(BSTR bstrCaption);
  54.     STDMETHOD_(void, AboutBox)(void);
  55.  
  56.     // OLE Control stuff follows:
  57.     //
  58.     CButtonControl(IUnknown *pUnkOuter);
  59.     virtual ~CButtonControl();
  60.  
  61.     // static creation function.  all controls must have one of these!
  62.     //
  63.     static IUnknown *Create(IUnknown *);
  64.  
  65.   private:
  66.     // overridables that the control must implement.
  67.     //
  68.     STDMETHOD(LoadBinaryState)(IStream *pStream);
  69.     STDMETHOD(SaveBinaryState)(IStream *pStream);
  70.     STDMETHOD(LoadTextState)(IPropertyBag *pPropertyBag, IErrorLog *pErrorLog);
  71.     STDMETHOD(SaveTextState)(IPropertyBag *pPropertyBag, BOOL fWriteDefault);
  72.     STDMETHOD(OnDraw)(HDC hdcDraw, LPCRECTL prcBounds, LPCRECTL prcWBounds, HDC hicTargetDev);
  73.     virtual LRESULT WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  74.     virtual BOOL    RegisterClassData(void);
  75.  
  76.     virtual HRESULT InternalQueryInterface(REFIID, void **);
  77.     virtual void    BeforeCreateWindow(void);
  78.     virtual void    AfterCreateWindow(void);
  79.  
  80.     // private state information.
  81.     //
  82.     BUTTONCTLSTATE m_state;
  83. };
  84.  
  85.  
  86. // TODO: if you have an array of verbs, then add an extern here with the name
  87. //       of it, so that you can include it in the DEFINE_CONTROLOBJECT.
  88. //       ie.  extern VERBINFO m_ButtonCustomVerbs [];
  89. //
  90. extern const GUID    *rgButtonPropPages [];
  91. DEFINE_CONTROLOBJECT(Button,
  92.     &CLSID_Button,
  93.     "ButtonCtl",
  94.     CButtonControl::Create,
  95.     1,
  96.     &IID_IButton,
  97.     "Button.HLP",
  98.     &DIID_DButtonEvents,
  99.     OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|OLEMISC_RECOMPOSEONRESIZE|OLEMISC_CANTLINKINSIDE|OLEMISC_INSIDEOUT,
  100.     RESID_TOOLBOX_BITMAP,
  101.     "ButtonWndClass",
  102.     1,
  103.     rgButtonPropPages,
  104.     0,
  105.     NULL);
  106.  
  107.  
  108.  
  109. #define _BUTTONCONTROL_H_
  110. #endif // _BUTTONCONTROL_H_
  111.  
  112.  
  113.